home *** CD-ROM | disk | FTP | other *** search
-
- /*
- ** Program to illustrate use of DFR8getdims, DFR8getimage and DFR8addimage
- **
- ** Files needed: old.hdf (look in "files" directory)
- ** Files created: new.hdf
- The image that is moved from old.hdf to new.hdf contains the spectrum
- of colors, moving from top to bottom, with ten vertical and ten
- horizontal lines cross-hatched.
- */
-
- #define HEIGHT 150
- #define WIDTH 200
- main()
- {
- int DFR8getdims(), DFR8getimage(), DFR8putimage();
- int ispal, ret, width, height;
- char image[HEIGHT][WIDTH], pal[768];
-
- /************* read in image *****************/
- DFR8getdims("old.hdf", &width, &height, &ispal);
- if (1 /* (width==WIDTH) && (height==150)*/ ) {
- ret = DFR8getimage("old.hdf",image,width,height,pal);
- printf("ret=%d\n",ret);
- } else {
- printf("width=%d height=%d\n",width, height);
- printf("Wrong dimensions. Program aborted.");
- exit(1);
- }
-
- /****** write same image to different file ***********/
- DFR8addimage("new.hdf", image, width, height, ispal);
-
- }
-